// 假设这是 GuessGame 类的定义
abstract class GuessGame {
    // guess 方法返回值：
    // -1: 我的数字小于你猜的数字
    //  1: 我的数字大于你猜的数字
    //  0: 我的数字就是你猜的数字
    public abstract int guess(int num);
}

public class Solution extends GuessGame {
    @Override
    public int guess(int num) {
        // 假设目标数字是 target
        int target = 6; // 可以修改为任意目标值
        if (num == target) {
            return 0;
        } else if (num < target) {
            return 1;
        } else {
            return -1;
        }
    }

    public int guessNumber(int n) {
        int left = 1, right = n;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (guess(mid) <= 0) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return left;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int n = 10; // 假设数字范围是 1 到 10
        int result = solution.guessNumber(n);
        System.out.println("The guessed number is: " + result);
    }
}